Event - drop

back to section start!

 
  Someone dropped something on our ArcDir lister, they're going to pay for 
that! 
 
  1        when event = 'drop' then do 
  2          parse var namestr '"' droppath '"' 
  3          if pos(right(droppath,1),'/:') > 0 then 
  4            lister read handle '"'droppath'"' force 
  5          else do 
  6            parse var namestr '"' dropfile '"' 
  7            if pos(':',dropfile) = 0 then do 
  8              lister query user path 
  9              dropfile = result||dropfile 
 10              end 
 11            dopus getfiletype '"'dropfile'"' id 
 12            if result = 'LHA' | result = 'LZX' then do 
 13              arctype = result 
 14              arcfile = dropfile 
 15              arcsubdir = '' 
 16              call delete('T:ArcDir.list'handle) 
 17              call arclist 
 18              end 
 19            else do 
 20              allents = namestr 
 21              call getall 
 22              otherhandle = user 
 23              call arcadd 
 24              end 
 25            end 
 26          end 
 
Line: 
 1      The event was drop which means something was 'dropped' onto our 
        lister, if they had dragged from our lister and dropped onto another 
        one then it would be a dropfrom event. 
 2      We parse what was dropped on us in namestr from between the quotes, 
        (I'll call it thing just to give it a name :) 
 3 - 4  If the right character of thing is a ':' or a '/' then they dropped 
        either a device on the lister or a directory.  So we'll just read 
        that path into the lister, this will kill our handler. 
 5 - 10 It wasn't a device/directory, what a relief, so now we parse it again 
        giving it the name dropfile.  If it doesn't contain a ':' character 
        then we need to find out where it came from by querying the path of 
        the lister whose handle was given in variable user.  We then let 
        dropfile equal the path and the filename. 
11      We find out what filetype ID the file has. 
12 - 18 If it was an LZX or LhA archive then we set arctype to the ID, 
        arcfile to the filename, the initial archive directory as root, 
        delete ArcDir's current working archive contents list and call the 
         arclist  routine to generate a new one on the new archive. 
19 - 25 OK, it's not a device, directory or another archive, must be a file 
        or a directory!  We make allents equal the namestr argument then 
        call  getall  to get all the names of the entries that were dropped 
        on the lister.  We then set otherhandle to equal the handle of the 
        lister where the files/dirs came from and call the  arcadd  routine 
        to add them to the archive. 
 

DOpus PLUS - giving you that bit extra...